package com.erp.dto;

import java.util.ArrayList;
import java.util.List;

import com.erp.domain.TPrivilege;
import com.erp.domain.TRole;

public class Role implements java.io.Serializable {

	private static final long serialVersionUID = 1L;

	/**
	 * 默认构造方法
	 */
	public Role() {
	}

	/**
	 * 将持久化对象的转化为数据传输对象
	 * 
	 * @param tRole
	 */
	public Role(TRole tRole) {
		this.id = tRole.getId();
		this.sign = tRole.getSign();
		this.name = tRole.getName();
		this.description = tRole.getDescription();
		List<TPrivilege> tPrivilegeList = tRole.getPrivileges();
		if (tPrivilegeList != null) {
			for (TPrivilege tPrivilege : tPrivilegeList) {
				this.privilegeList.add(new Privilege(tPrivilege));
			}
		}
	}

	private Integer id;
	private String sign;
	private String name;
	private String description;
	private List<Privilege> privilegeList = new ArrayList<Privilege>(0);

	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getSign() {
		return sign;
	}

	public void setSign(String sign) {
		this.sign = sign;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public List<Privilege> getPrivilegeList() {
		return privilegeList;
	}

	public void setPrivilegeList(List<Privilege> privilegeList) {
		this.privilegeList = privilegeList;
	}

}